SPB Git forge
28commits 1branches 0releases
7.7 MBsize
maindefault branch
10 days agolast push
Python 66.3% TypeScript 22.7% JavaScript 8.6% HTML 1.4% CSS 0.7%
1.1 KB · 31 lines tsx
Raw Blame History
1import { api, safe } from '@/lib/api';2import { fmtInt } from '@/lib/format';3import { OG_CONTENT_TYPE, OG_SIZE, renderSiteOg, renderTopicOg } from '@/lib/og';4import { SITE_NAME } from '@/lib/site';56/** Industry share image: name, description, monitored companies, activity counters. */7export const alt = `Industry on ${SITE_NAME}`;8export const size = OG_SIZE;9export const contentType = OG_CONTENT_TYPE;1011export default async function IndustryOpenGraphImage({ params }: { params: Promise<{ slug: string }> }) {12  const { slug } = await params;13  const d = await safe(api.industry(slug));14  if (!d) return renderSiteOg(await safe(api.stats()));15  const list = Array.isArray(d.companies) ? d.companies : [];16  const count = Array.isArray(d.companies) ? d.companies.length : d.companies;17  return renderTopicOg({18    eyebrow: 'Industry',19    title: d.name,20    subtitle: d.description,21    names: list.map((c) => c.display_name),22    counters: [23      ['Companies', fmtInt(count)],24      ['Events 7d', fmtInt(d.events_7d)],25      ['Events 30d', fmtInt(d.events_30d)],26      ['Open jobs', fmtInt(d.hiring?.open)],27    ],28    path: `/industry/${d.slug}`,29  });30}31